var swiperImgEle = document.querySelector("#swipperImg");
var afterBtn = document.querySelector("#afterSwipper");
var nextBtn = document.querySelector("#nextSwipper");
// var srcArray = [
//     `img/index/11.jpg.png`,
//     `img/index/57.jpg.png`,
//     `img/index/58.jpg.png`,
//     `img/index/59.jpg.png`,
// ];
var srcArray = [
    `img/index/11.jpg.png`,
    `img/index/57.png`,
    `img/index/58.png`,
    `img/index/59.png`,
];
var srcIndex = 0;
/**
 * 改变图片
 */
function changeImg() {
    var box = document.querySelector('.imgSwiperBox');
    box.innerHTML = "";
    var ele = document.createElement(`img`);
    ele.src = srcArray[srcIndex];
    ele.id = `swipperImg`;
    ele.style.width = `100%`;
    box.appendChild(ele);
}
/**
 * 轮播图next张图片按钮点击函数
 */
function nextImg() {
    console.log(srcArray[srcIndex], srcIndex);
    console.log(`next`);
    if (srcIndex < srcArray.length - 1) {
        srcIndex++;
        changeImg();
    }
}
/**
 * after一张
 */
function afterImg() {
    console.log(srcArray[srcIndex], srcIndex);
    if (srcIndex > 0) {
        srcIndex--;
        changeImg();
    }
}
afterBtn.addEventListener("click", afterImg);
nextBtn.addEventListener("click", nextImg);